<?php 
if(KT!='KhiThe') exit;
class supports_model extends khithe_mysql{public function getsupports()
	{		
		$select = "SELECT * FROM ".supports." ORDER BY `Order` ASC";
		$result = parent::SelectMySQL($select);
		parent::CloseConnection();
		return$result; 
	}public function getsupportID($ID){
		
		$ID = parent::checkStrMySQL($ID);
		$select = "SELECT * FROM ".supports." WHERE ID = '".$ID."'";
		$result= parent::SelectMySQL($select);
		parent::CloseConnection();
		return $result;
	}public function setCheckedsupport($ID,$Val)
	{
		$ID = parent::checkStrMySQL($ID);
		$update = "UPDATE ".supports." SET Status='".$Val."'  WHERE ID = '".$ID."'";
		parent::CloseConnection();
		return parent::UpdateInsertMySQL($update);
	}public function delCheckedsupport($ID)
	{
		$ID = parent::checkStrMySQL($ID);
		$del = "DELETE FROM ".supports." WHERE ID='".$ID."' ";
		parent::CloseConnection();
		return parent::DeleteMySQL($del);
	}public function updateInsertsupport($_POST)
	{
		$ID = parent::checkStrMySQL($_POST['supportsID']);
		$supportname = parent::checkStrMySQL($_POST['txt_supports']);
		$kind = parent::checkStrMySQL($_POST['kind']);
		$Fullname = parent::checkStrMySQL($_POST['txt_Fullname']);
		$order = parent::checkStrMySQL($_POST['txt_order']);
		
		if($_POST['acsupport']=='edit'){
			$query = "UPDATE ".supports." SET Nick='".$supportname."',kind='".$kind."',Fullname='".$Fullname."',`Order`='".$order."' WHERE ID = '".trim($ID)."'";
		
		}else if($_POST['acsupport']=='add'){
			$query = "INSERT INTO ".supports."(Fullname,Nick,Kind,`Order`,`Status`)VALUES('".$Fullname."','".$supportname."','".$kind."','".$order."','true')";
		}
		
		parent::CloseConnection();
		return parent::UpdateInsertMySQL($query);
		
	}
}
?>